Templates

References


Main points

Example 1

#include<iostream>
auto multiply(auto a, auto b)
{
return a*b;
}

int main()
{
int a=2,b=4;
float c=2.5,d=2;
std::cout<<multiply(a,b)<<"\t"<<multiply(c,d)<<std::endl;
return 0;
}

Output
8 5

It is process of making codes by compiler, In previous lecture 1 we saw that the compiler was make codes for us, and that is known as Instantiation.